function vardata = hslice_on_depth ( gdata, time_index, vardepth )
% HSLICE_ON_DEPTH:  slice the given hyperslab on depth, not sigma
%
%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% $Name: rslice-0_9_2 $
% $Id: hslice_on_depth.m,v 1.1 2005/07/13 18:33:16 jevans Exp $
% AUTHOR:  johnevans@acm.org
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

ncfile =  gdata.ncfile_list{gdata.ncfile_index};

%
% Try to retrieve the data.
switch ( gdata.dim_type )
case 'TZYX'
	[x,y,vardata] = roms_zslice ( gdata, time_index, vardepth );
case 'TYX'
	start = [time_index 0 0];
	stop = [1 -1 -1];
	vardata = nc_varget ( ncfile, gdata.varname, start, stop );
case 'YX'
	vardata = nc_varget ( ncfile, gdata.varname );
otherwise
	msg = sprintf ( '%s:  unhandled dimensionality %s on %s, file %s.\n', mfilename, gdata.dim_type, gdata.varname, ncfile );
	rslice_error ( msg );
end


